<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 依次打印
        // var arr = ['关羽', '张飞' , '宋江', '刘备'];
        // for (var i = 0; i < arr.length; i++) {
        //     console.log(arr[i]);
        // }
        var arr = [2, 6 , 1, 7, 4];
        var sum = 0;
        var average = 0;
        var max = -Infinity;
        for (var i = 0; i < arr.length; i++) {
            sum += arr[i];
            if (arr[i] > max) {
                max = arr [i];
            }
        }
        average = sum / arr.length;
        console.log(sum);
        console.log(average);
        console.log(max);
    </script>
</body>
</html>
